﻿@model Survey.Common.Models.Services.IUserModel

@this.CreateForm()

@AddControls(
    new Fieldset("w48p mh50 ", Str.Business.Common.Identification)
    {
        new DefinitionList(PercentForLabel.p30)
        {
            new TextOrInput(true)
                .SetSourceProperty(() => Model.Item.ID),

            new TextOrInput().SetSourceProperty(() => Model.Item.Login),
        }
    },
    new Fieldset("w49p mh50 ", "Person")
    {
        new DefinitionList(PercentForLabel.p30)
        {
            new TextOrInput().SetSourceProperty(() => Model.Item.FirstName),

            new TextOrInput().SetSourceProperty(() => Model.Item.LastName),
        }
    },
    new Fieldset("w48p mh130 ", "Roles")
    {
        new DefinitionList(PercentForLabel.p30)
        {
            new MultiOption()
                .SetSourceProperty(() => Model.Item.Roles)
                .SetDataSource(SecurityManager.ApplicationRoles.ToDictionary(r => r, r => r))
                .SetSize(8)
                .SetDataTextField("Key")
                .SetDataValueField("Value")
                .ShowEmpty(true)
                .SetNotFoundOrNullTemplate("=== none ===")
        }
    })

@AddControls(
  !SecurityManager.IsAuthenticationModeForms ? null :
    new Fieldset("w49p mh130 ", "Login")
    {
        new DefinitionList(PercentForLabel.p30)
        {
            new DefinitionListItem("Password")
            {
                new Input(InputType.Password)
                    .SetName(Model.IsAction("Edit") ? "Member.NewPassword" : "Member.Password"),
            },
            new DefinitionListItem("ConfirmedPassword")
            {
                new Input(InputType.Password).SetName("Member.ConfirmedPassword"),
            },
            //new TextOrInput().SetSourceProperty(() => Model.Item.Member.Email)
            //    .SetPrefix("Member"),
        }
    }
)

@this.CloseForm()